New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(tests): Error setting style property of DOM element in e2e tests #2874
Conversation
Hmm, I've got the impression that you are trying to bind to the What you should be doing instead today is one of:
|
That does have a lot of sense.... But I'm not the one trying to do that but something in the e2e tests... Although you sound completely right. This might not be the place to solve it. I'll review it and report back. Thank you! |
As said you were totally right... The problem is in modules\benchmarks\src\naive_infinite_scroll\cells.ts |
Oh, I didn't realise it was in the e2e tests... This doesn't look right and I'm surprised that it works at all and passes tests on the CI server :-/ |
Yes... I was surprised it was just happening to me... Anyway I was trying to solve this when I realized this can be a problem when dealing with components... I mean without the fix in the PR this is supposed to work like you said:
But what if instead of a plain div we have a component... In order to use that syntax in it's template it should know in advance which styles it's going to accept (probably all of them). Doesn't it have more sense for the angular framework to abstract components for that complexity? Like:
And then:
Anyway, this may be out of the scope of this PR... I'm going to change both files and revert back the other change and upload. Thanks! |
Remember that there is the ng-style directive to bind to any style. So you can do |
Oops. Didn't knew... That's what happens when you answer something on the fly without investigation... Sorry for that. Any way. Back to coding :-). |
0a59b46
to
665a549
Compare
665a549
to
957e2bf
Compare
@alfonso-presa your changes, as done, have no effect really as the I can see 2 solutions:
@tbosch do you recall why we play with those styles at all? |
My first attempt was to use the `[style.name]="exp"`` but for some reason it broke the dart build (https://travis-ci.org/angular/angular/jobs/69549832). Dart templates are using NgStyle BTW, so I thought that in shake of consistency it was better to use NgStyle. About the PR as is... you're right... I forgot to add the directive dependency. Oops. Anyway I guess is up to you guys to decide which is the best path to solve this before I continue with the PR. IMHO from the developer's perspective the best is to have the Thanks! |
957e2bf
to
3712366
Compare
In the meanwhile I decided to solve the problem as is using NgStyle to fix the tests with the minimum impact in functionality. I guess it can be refactored later if you decide style is not necessary. BTW.... this now needs #2878 because NgStyle was not exported in directives... Should it be used somehow else? Thanks! |
3712366
to
e927e2d
Compare
@alfonso-presa so, we've discussed this one internally, and ideally we would like to avoid using any additional directives in this perf-measuring test. Could you please update your PR by:
Thnx! Let me know if you face any issues! |
Of course I can :-). I'll let you know if a face those weird DART build errors again when changing to Thank you. |
068755e
to
e4a479f
Compare
I'm facing the same DART issues I encountered before while trying to solve this. I guess it's because of the Dart transpiled version of the tests... but I'm not sure how to solve the problem: Is it mandatory to use the 'MapWrapper.createFromPairs' for the Dart transpiler to work? If I use that then the I'll keep on trying tomorrow anyway. Thanks! EDIT: MapWrapper also fails.... |
e4a479f
to
667d61e
Compare
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
0ab9a0b
to
a619b7e
Compare
CLAs look good, thanks! |
I've been able to make it work by using an external class syntax... But I don't think it's the best way to write that code: https://github.com/angular/angular/pull/2874/files#diff-6a123cac4f61bcef66473b5c01dd6dacR83 Any advices? |
@alfonso-presa I've left a comment - IMO we can make it simpler by moving "hard-coded" style to a template. It would be totally awesome if you could also:
I think that we are close, keep up the good work! |
a619b7e
to
6e927f6
Compare
Thank you very much for the tip :-). I'm going to try to fix it first and then I'll squash everything together. |
Fixes the following error in e2e tests: "Cannot set property style of \#<HTMLElement> which has only a getter".
6e927f6
to
17946b2
Compare
Ok. This should be ready to merge now :-). Let me know if anything more is needed. Just to let you know, about the problems I encountered during the dart build (https://travis-ci.org/angular/angular/jobs/70809349#L1966), it really feels like there is something in ts2dart or in dart2js that is not working properly... I'm investigating this just for fun :-). Any way, it's completely out of the scope of this PR. Thanks! |
Landed as cd532b0. Thnx @alfonso-presa for bearing with me and iterating on this one, great job! |
Thank you! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes the following error: Cannot set property style of
# which has only a getter. Instead of overriding object
directly it resets it's properties and copies the new ones.
I saw this error in latest Canary and Regular chrome versions in Linux, OSX and Windows, but I didn't saw anyone reporting this as Issue so may be it's just myself. Anyway, here you have the fix I made. I'm not too much into TS so there might be a better way to handle object properties looping... So please, if there's any improvement to do, don't hesitate telling me and I will update the code ASAP.
Thanks!